<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>数据统计</title>
  <link rel="stylesheet" href="/layui/css/layui.css">
  <link rel="stylesheet" href="/css/HyqPublic.css">
  <link rel="stylesheet" href="/css/StoreCode.css">
</head>
<style type="text/css">
  /*------------分页部分--------------*/
    .pageing-container-h{
      display: flex;
      justify-content: space-between;
      padding: 0px 20px 20px 20px;
    }
    .pageing-content-h{
      line-height: 28px;
    }
    .pageing-content-h a{
      border: 1px solid #e2e2e2;
      padding: 4px 15px;
      color: #333;
      line-height: 28px;
      border-radius: 2px;
    }
   .current{
     background: #1E9FFF !important;
     color: #fff !important;
   }
</style>
<body>
<!-- 主要内容区 -->
<div class="StoreCode_main_container">
  <!-- 主要内容区切换tabs -->
  <ul class="StoreCode_mainNav_container">
    <a href="index.html"><li data-type="store">多群引流列表</li></a>
    <a href="data_details-1.html"><li class="StoreCode_mainNavActive"  data-type="data">数据详情</li></a>
  </ul>
  <!-- 切换区数据分析页面 -->
  <div class="StoreCode_TabsDataAnalysis_container" >
    <div class="StoreCode_TabsDataAnalysis_Header_container">
      <form style="margin: 5px 0px; padding: 10px 0;" class="layui-form">
        <div class="layui-inline">
          <label style="width: auto;" class="layui-form-label">多群引流：</label>
          <div class="layui-input-inline">
            <select name="mgroup" lay-search="" lay-filter="mgroup">
              {loop $mgroups as $mgroup}
              <option value="{$mgroup->id}" {if $mgroup->id == $id}selected{/if}>{$mgroup->name}</option>
              {/loop}
            </select>
          </div>

        </div>
      </form>
      <div class="StoreCode_TabsDataAnalysis_Header_content">
        <ul class="StoreCode_TabsDataAnalysis_HeaderList_container">
          <li>
            <b id="totaySm">0</b>
            <span>今日扫码人数</span>
          </li>
          <li>
            <b id="allSm">0</b>
            <span>今日进群人数</span>
          </li>
        </ul>
        <ul class="StoreCode_TabsDataAnalysis_HeaderList_container">
          <li>
            <b id="todayJq">0</b>
            <span>总扫码人数</span>
          </li>
          <li>
            <b id="totalJq">0</b>
            <span>总进群人数</span>
          </li>
        </ul>
      </div>
    </div>
    <div class="gray-bar"></div>
    <!-- 第二级切换 -->
    <ul class="StoreCode_TabsDataAnalysis_secendTabs_container">
      <li {if $type == 1} class="StoreCode_TabsDataAnalysis_secendTabs_active" {/if} ><a href="detail-1.html">查看客户数据</a></li>
      <li {if $type == 2} class="StoreCode_TabsDataAnalysis_secendTabs_active" {/if}><a href="detail-2.html">查看群数据</a></li>
    </ul>
    {if $type == 1}
    <!-- 查看客户数据 tabs区域 -->
    <div class="StoreCode_TabsDataAnalysis_Main_container">
      <div class="StoreCode_TabsStoreList_From_container layui-form">
        <div class="public_form_conainer public_search_container">
          <span class="public_formTitle">客户昵称：</span>
          <div class="public_search_content">
            <input type="text" placeholder="请输入客户昵称" id="user_name" value="{$user_name}">
            <svg t="1622189504456" onclick="search('user_name')" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2625" width="17" height="17"><path d="M426.666311 853.332622a426.666311 426.666311 0 1 1 426.666311-426.666311 426.666311 426.666311 0 0 1-426.666311 426.666311z m0-767.99936a341.333049 341.333049 0 1 0 341.333049 341.333049 341.333049 341.333049 0 0 0-341.333049-341.333049z" p-id="2626" fill="#8c8c8c"></path><path d="M981.332516 1023.999147a42.666631 42.666631 0 0 1-30.293309-12.373323L682.666098 743.252714A42.666631 42.666631 0 0 1 743.252714 682.666098l268.37311 267.946443a42.666631 42.666631 0 0 1 0 60.586616 42.666631 42.666631 0 0 1-30.293308 12.79999z" p-id="2627" fill="#8c8c8c"></path></svg>
          </div>
        </div>
      </div>
      <!-- table 上的按钮区域 -->
      <div class="StoreCode_TabsStoreList_tableHeader_container">
        <h3>共{$count}个客户</h3>
        <ul class="StoreCode_TabsStoreList_tableHeaderButton_container">
          <li>
          </li>

        </ul>
      </div>
      <!-- table 区域 -->
      <div class="StoreCode_TabsStoreList_table_container mcheckbox-table">
        <table class="layui-table layui-form" lay-skin="line">
          <thead>
            <tr>
              <th lay-data="">客户昵称</th>
              <th lay-data="">加入群聊</th>
              <th lay-data="">添加时间</th>
              <th lay-data="">操作</th>
            </tr>
          </thead>
          <tbody>
            {loop $res as $et}
          <tr>
              <td >{$et["name"]}</td>
              <td>
                {foreach $et['allchat'] as $allchat}
                <p>$allchat['name']</p>
                {/foreach}
              </td>
              <td>
                {foreach $et['allchat'] as $allchat}
                <p>$allchat['join_time']</p>
                {/foreach}
              </td>
              <td>
                  <a target="_blank" href="/Addons/QyWechat/admin/Externalcontact/customer_info-{$et['id']}.html" class="table-public-btn">客户详情</a>
                </td>
          </tr>
          {/loop}
          </tbody>
        </table>
      </div>
      <div class="main-container-h pageing-container-h">
          <div class="pageing-content-h">
              <span>{$p->totalnum}条/{$p->totalpage}页</span>
          </div>
            <ul class="pageing-content-h">{P weidogsadmin}</ul>
          </div>
    </div>
    {/if}
    <!-- 查看门店数据 -->
    {if $type == 2}
    <div class="StoreCode_TabsDataStore_Main_container">
      <div class="StoreCode_TabsStoreList_From_container layui-form">
      </div>
      <!-- table 上的按钮区域 -->
      <div class="StoreCode_TabsStoreList_tableHeader_container">
        <h3>共{$count}个群聊</h3>
      </div>
      <!-- table 区域 -->
      <div class="StoreCode_TabsStoreList_table_container">
        <table class="layui-table layui-form" lay-skin="line">
          <colgroup>
            <col>
            <col>
            <col>
            <col width="150">
            <col width="150">
            <col width="100">
            <col width="120">
          </colgroup>
          <thead>
            <tr style="background: #fcfcfc;">
              <th>群名称</th>
              <th>今日进群客户数</th>
              <th>总进入客户数</th>
              <th>操作</th>
            </tr> 
          </thead>
          <tbody>
            {loop $res as $chat}
            <tr>
              <td>{$chat["name"]}</td>
              <td>{$chat["todayJq"]}</td>
              <td>{$chat["todalJq"]}</td>
              <td class="table-btn-container">
                    <span class="table-public-btn" onclick="details('{$chat->id}')">群详情</span>
              </td>
            </tr>
            {/loop}
          </tbody>
        </table>
      </div>
      <div class="main-container-h pageing-container-h">
          <div class="pageing-content-h">
              <span>{$p->totalnum}条/{$p->totalpage}页</span>
          </div>
            <ul class="pageing-content-h">{P weidogsadmin}</ul>
          </div>
    </div>
    {/if}
  </div>
</div>
<script src="/cdn/jquery.min.js"></script>
<script src="/layui/layui.all.js"></script>
<script src="/js/ajax.js"></script>
<script type="text/javascript">
  var id = "{$id}"
  form = layui.form;
  $('#checkLable').on('click',function(){
    layer.open({
      type: 2,
      title: '请选择标签',
      shadeClose: true,
      shade: 0.2,
      area: ['700px', '530px'],
      content: 'select_tag.html'
    }); 
    })
    
  //select下拉框选中触发搜索
  form.on("select(mgroup)", function(data){
    console.log(window.location)
    if(data.value == id){
      layer.msg('选择为当前活动')
      return  
    }
    return
    window.location.href = window.location.pathname+"?id="+data.value;
  });

  function details(id){
    layer.open({
      type: 2,
      title: '查看群详情',
      shadeClose: true,
      shade: 0.2,
      area: ['900px', '500px'],
      content: 'select_details-'+id+'.html'
    }); 
  }
  
</script>
<script type="text/javascript">
  layui.use('form', function(){
    var form = layui.form;

    //监听提交
    form.on('submit(formDemo)', function(data){
      layer.msg(JSON.stringify(data.field));
      return false;
    });
    
  });
  layui.use('laydate', function(){
    var laydate = layui.laydate;
    //日期时间范围
    laydate.render({ 
      elem: '#test10'
      ,range: true //或 range: '~' 来自定义分割字符
    });
    
  });
</script>
<script type="text/javascript">
  
  $(document).ready(function(){
      myAjaxPost(false, true, 'statitic.html?id='+id, {}, function (resp) {
        console.log(resp)
        if (resp.status == 'success') {
          $("#totaySm").html(resp.data.totaySm)
          $("#allSm").html(resp.data.allSm)
          $("#todayJq").html(resp.data.todayJq)
          $("#totalJq").html(resp.data.totalJq)
        }
      });
  });
</script>
</body>
</html>